// pages/user-wddp/user-wddp.js
var util = require('../../utils/network.js')
Page({

  /**
   * 页面的初始数据
   */
  data: {
      stars: [0, 1, 2, 3, 4],
      normalSrc: '../../image/normal.png',
      selectedSrc: '../../image/selected.png',
      key: 1,//评分
      score: [
          { "text": "总体评价", "id": 0 },
          { "text": "准点率", "id": 1 },
          { "text": "舒适度", "id": 2 },
          { "text": "车辆服务", "id": 3 }
      ],
      scores: [0, 0, 0],
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
      var token = util.token
      var that = this
      wx.request({
          url: util.main + '/queryassessmentinfo/0',
          data: {
              "orderno": 7687118148,
              "token": token,
              "userid": wx.getStorageSync("userId")
          },
          header: {
              "content-type": "application/json",
              "accept": "application/json,",
          },
          method: "GET",
          dataType: "json",
          success: function (res) {
              var buysatisfy = res.data.buysatisfy//整体评价
              var punctuality = res.data.punctuality//准点率
              var ridesatisfy = res.data.ridesatisfy//舒适度
              var serve = res.data.serve//车辆服务
              var arr = [buysatisfy, punctuality, ridesatisfy, serve]
              if (res.statusCode==200){
                  that.setData({
                      scores: arr
                  })
              }
          }
      })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
  
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
  
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
  
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
  
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
  
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  }
})